MSEQ

Section: User Commands (1)
Index Return to Main Contents

BSD mandoc
TCLM April 7, 1993  

NAME

mseq - a tclm script to sequence MIDI files according to a simple language  

SYNOPSIS

[sequence_file [midi_file] ]  

DESCRIPTION

is a tclm(1) script that sequences Standard MIDI files according to a simple language. The sequenced result is placed in a new MIDI file.

If an output MIDI file is not specified, then output is sent to stdout If an input sequence file is not specified then input is read from stdin

The purpose of is to generate more complicated MIDI files from smaller MIDI file components.  

SEQUENCING LANGUAGE

The language uses is ``spartan'' at best, but does provide useful functionality. It allows one to play parts in parallel by specifying information for different tracks, group phrases into blocks and repeat blocks.

The BNF or quasi- BNF as I don't quite remember the true form, looks like this:

mseq_file :== section+
section :==
track statement+
statement :== labeled sequence | filename | command | comment
labeled sequence :== label sequence
label :==
name :
sequence :== block | filename
block :==
{ sequence+ }
command :==
repeat label | repeat label multiplier
multiplier :== number
comment :==
# anything to end-of-line

The results look like this (though this isn't a very practical example):

track
# This is track 1
pat1.mid
pat2.mid
A: {
        pat3.mid
        B: { # block B:
                pat4.mid
                pat5.mid
        }
        pat6.mid
        repeat B: 3
}
pat7.mid
pat8.mid # pattern 8

# This is track 2
track
pat1.mid
pat2.mid
A: {
        pat3.mid
        pat4.mid
        B: pat5.mid
        pat6.mid
        repeat B: 6
}
pat7.mid
repeat A:

There are six main parts to a sequence file. There are tracks blocks repeats comments and files The tracks are different sections of the sequence that should play in parallel and should belong to separate tracks in the output MIDI file. Each track will start at time 0, the beginning of the sequence. Every sequence must have at least one track. Tracks are designated by the word track This is a simple example of using tracks,

track
part1.mid
part2.mid
part3.mid

track
partA.mid
partB.mid
partC.mid

In this case two tracks will be created and, assuming all the parts are the same length, part1.mid will be played the same time partA.mid is played, part2.mid will be played the same time partB.mid is played, etc.

Blocks are groups of one or more files or other blocks. Each block has a label, which is designated by ending in a So : Sc . If a block is to consist of only on file, then it may be labeled directly like,

ShortBlock: part1.mid

Otherwise the block should be enclosed in curly braces like,

LongerBlock: {
        part1.mid
        part2.mid
        part3.mid
}

Blocks may even contain other blocks like,

OutterBlock: {
        part1.mid
        InnerBlock: {
                part2.mid
                part3.mid
        }
        part4.mid
}

In this case InnerBlock: contains part2.mid and part3.mid while OutterBlock: contains part1.mid , part2.mid , part3.mid part4.mid

Repeats provide a way of re-sequencing previously defined blocks. Repeats consist of the string repeat followed by a block name, including the colon, and an optional number. The optional number specifies the number of times the block should be repeated. If no number is specified, the block is only repeated once. A simple example of a repeat looks like,

ABlock: part1.mid
repeat ABlock: 3

The sequence generated by this fragment would contain, part1.mid , part1.mid , part1.mid and part1.mid A more complicated example might look like,

Block1: {
        part1.mid
        part2.mid
        Block2: {
                part3.mid
                part4.mid
        }
        repeat Block2: 2
}
part5.mid
repeat Block1:

This sequence generates, part1.mid , part2.mid , part3.mid part4.mid , part3.mid , part4.mid part3.mid , part4.mid , part5.mid part1.mid , part2.mid , part3.mid part4.mid , part3.mid , part4.mid part3.mid and part4.mid

Comments begin with a `#' and continue to the end of a line. completely ignores anything in a comment. This is an example of a few comments,

track
# This track is for the drum part
backbeat: pat1.mid
repeat pat1.mid 7
pat2.mid   # here's a turn around fill

The final part of a sequence file is the most important. It is the filenames of the smaller MIDI files that are to be sequenced. Each filename specifies one MIDI file and is read into the sequence as they are encountered in the sequence file. They are also read in when blocks containing them are repeated. Currently, only MIDI files of format 1 are accepted.

Though there is not much complexity in the sequencing language, it should be rich enough to allow the easy creation of sophisticated MIDI files.  

OUTPUT MIDI FILE

The final output MIDI file created from the sequence is in the Standard MIDI Format, and is a format type 1 file. All the meta events from each sequenced MIDI are merged together and put in track 0 at their proper relative times. For instance, a metaseqname event occurring at time 10 in the first track will be at time 10 in the output file as will a metaseqname event occurring at time 10 in the third track. Be aware of potential conflicts between metatempo events in different tracks.

The remaining tracks in the output MIDI file will correspond to the tracks in the sequence file. These tracks are created by collapsing each smaller MIDI file listed in the sequence file to just two tracks, track 0 which remains unchanged, and track 1 which is created by merging all the other tracks in the file. These collapsed files are then concatenated together to form one long MIDI file for each track. As mentioned above, the track 0's from each sequence track are then merged to form one new track 0 while the other tracks are kept separate in the final output.

The resulting MIDI file can then be manipulated just like any other MIDI file.  

SEE ALSO

tclm(1), midimerge(3), midiget(3)  

AUTHORS

Mike Durian - durian@advtech.uswest.com


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEQUENCING LANGUAGE
OUTPUT MIDI FILE
SEE ALSO
AUTHORS

This document was created by man2html, using the manual pages.
Time: 00:28:07 GMT, March 30, 2022